import instance from './index';
import qs from 'qs';

const preUrlPath = '';
//获取CNY充值列表
const request = {
  p: ['api:user:fetch'],
  r: params => {   
    return instance.post(`/v1/account/fetchRechargePageList`, qs.stringify(params),{ headers:{'Content-Type':'application/x-www-form-urlencoded'}}).catch(function(res){
      console.log(res)
    })
  }
};
//获取CNY提现列表
const requestList = {
  p: ['api:user:fetch'],
  r: params => {
    return instance.get(`/v1/account/fetchWithdrowPageList`, {params}).catch(function(res){
      console.log(res)
    })
  }
};
//用户CNY充值
const addrecharge = {
  p: ['api:user:new'],
  r: params => {
    return instance.post(`/v1/account/userRecharge`, qs.stringify(params),{ headers:{'Content-Type':'application/x-www-form-urlencoded'}}).catch(function(res){
      console.log(res)
    })
  }
};
//用户CNY提现
const addwithdraw = {
  p: ['api:user:new'],
  r: params => {
    return instance.post(`/v1/account/userWithdraw`, qs.stringify(params),{ headers:{'Content-Type':'application/x-www-form-urlencoded'}}).catch(function(res){
      console.log(res)
    })
  }
};

//用户绑定银行卡
const bandCard = {
  p: ['api:user:new'],
  r: params => {
    return instance.post(`/v1/user/bindBankCard`, qs.stringify(params),{ headers:{'Content-Type':'application/x-www-form-urlencoded'}}).catch(function(res){
      console.log(res)
    })
  }
};


//越权请求
const notAllowed = {
  p: ['get,/roles/notAllowed'],
  r: params => {
    return instance.get(`${preUrlPath}/GET/roles/notAllowed`, {params})
  }
}

export {
  request,
  requestList,
  addrecharge,
  notAllowed,
  addwithdraw,
  bandCard,
 
}
